<script setup>
  import { defineProps, defineEmits } from 'vue'
  defineProps({
    name: {
      type: String,
      default: ''
    },
    styles: {
      type: Object,
      default: () => {}
    },
    isBack: {
      type: Boolean,
      default: false
    },
    backRouter: {
      type: String,
      default: ''
    }
  })
  const emit = defineEmits(['routerBack'])
  function back() {
    emit('routerBack')
  }
</script>

<template>
  <div class="header" :style="styles">
    <div class="header-title">
      <i v-if="isBack" class="el-icon-arrow-left" @click="back"></i>
      <h3>{{ name }}</h3>
    </div>
    <slot></slot>
  </div>
</template>

<style lang="scss" scoped>
  .header {
    width: 100%;
    display: flex;
    align-items: center;
    background: #fff;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.05);
    &-title {
      display: flex;
      align-items: center;
      h3 {
        min-width: 100px;
        font-size: 20px;
        margin-right: 50px;
      }
    }
  }
  :deep(.el-icon-arrow-left) {
    font-weight: bold;
    font-size: 22px;
    margin-right: 5px;
    margin-top: 2px;
    cursor: pointer;
  }
</style>
